package com.lkd.feignService;

import com.lkd.feignService.fallback.OderServiceFallbackFactory;
import com.lkd.viewmodel.OrderViewModel;
import com.lkd.viewmodel.Pager;
import com.lkd.viewmodel.RequestPay;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;

@FeignClient(value = "order-service",fallbackFactory = OderServiceFallbackFactory.class)
public interface OrderService {
    @PostMapping("wxpay/requestPay")
    String requestPay(@RequestBody RequestPay requestPay);

    @GetMapping("/order/cancel/{orderNo}")
    Boolean cancel(@PathVariable String orderNo);
    @GetMapping("/order/search")
    Pager<OrderViewModel> search(
            @RequestParam(value = "pageIndex", required = false, defaultValue = "1") Integer pageIndex,
            @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
            @RequestParam(value = "orderNo", required = false, defaultValue = "") String orderNo,
            @RequestParam(value = "openId", required = false, defaultValue = "") String openId,
            @RequestParam(value = "startDate", required = false, defaultValue = "") String startDate,
            @RequestParam(value = "endDate", required = false, defaultValue = "") String endDate);

    @GetMapping("/report/serach/{partnerId}")
    List<OrderViewModel> report(@PathVariable(value = "partnerId") String id,
                                @RequestParam(value = "pageIndex",required = false,defaultValue = "") Integer pageIndex,
                                @RequestParam(value = "pageSize",required = false,defaultValue = "")Integer pageSize,
                                @RequestParam(value = "start",required = false,defaultValue = "")String start,
                                @RequestParam(value = "end",required = false,defaultValue = "") String end,
                                @RequestParam(value = "nodeName",required = false,defaultValue = "")String nodeName);

    @GetMapping("/report/collectReport/{partnerId}/{start}/{end}")
    Map<String,List> collectReport(@PathVariable(value = "partnerId") String partnerId,
                                   @PathVariable(value = "start") String start,
                                   @PathVariable(value = "end") String end);
    @GetMapping("/report/amountCollect/{type}/{start}/{end}")
    public Map amountCollect(@PathVariable("type") Integer type,
                             @PathVariable("start") String start,
                             @PathVariable("end") String end);
    @GetMapping("/report/regionCollect/{start}/{end}")
    public Map regionCollect(@PathVariable("start") String start,
                             @PathVariable("end") String end);
}
